﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace _10_HPBar
{
    internal class DataSystem
    {
        static DataSystem? instance = null;
        public static DataSystem? Instance
        {
            get
            {
                if (instance == null)
                {
                    instance = new DataSystem();
                }
                return instance;
            }
        }
        private DataSystem()
        {

        }
        string data = "";
        public string LoadData(string path)
        {
            

            if (File.Exists(path))
            {
                using(StreamReader sr = new StreamReader(path))
                {
                    data = sr.ReadToEnd();
                }
            }
            return data;
        }

        public void SaveData(string path,string data)
        {
            using(StreamWriter sw = new StreamWriter(path))
            {
                sw.WriteLine(data);
            }
        }
    }
}
